﻿@using Coralcode.Adapter.StatVisit.Entity.Domains
@using Coralcode.Utils.Basic
@using CoralNode.MvcClient.Helper
@{
    ViewBag.Title = "来源分析-搜索词统计";
    ViewBag.PageModule = "source";
    ViewBag.CurrentPageUrl = "/m/statistic/sourceenginekey?";
}
@Html.IncludePage("CoralAdmin/statistic", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        @Html.IncludePage("CoralAdmin/statistic", "DateSelection")
        <div class="main-box mt_2 mb_2">
            <div class="tab-visit clearfix">
                <a href="/m/statistic/source?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">来源分类统计</a>
                @*<a href="/m/statistic/sourcelog?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">来源明细</a>
                    <a href="/m/statistic/sourceengine?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">搜索引擎统计</a>*@
                <a class="current" href="/m/statistic/sourceenginekey?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">搜索词统计</a>
            </div>
            <div class="clearfix">
                <div class="table_visit">
                    <table width="100%" style="margin-top:2px;">
                        <thead>
                            <tr class="t_bg headRow">
                                <td width="20"></td>
                                <td>搜索词</td>
                                <td></td>
                                <td align="right"><a class="order_up" href="#"><i></i>来访次数</a></td>
                                <td align="right">独立访客(UV)</td>
                                <td align="right">IP</td>
                                <td align="right">新独立访客</td>
                                <td align="right">跳出率</td>
                                <td align="center">引擎</td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr class="count">
                                <td></td>
                                <td>全站总计</td>
                                <td></td>
                                <td align="right">@Model.SessionCount</td>
                                <td align="right">@Model.UniqueVisitor</td>
                                <td align="right">@Model.IpCount</td>
                                <td align="right">@Model.NewUniqueVisitor</td>
                                <td align="right">@MathUtil.RoundPercent(Model.BounceRate)%</td>
                                <td></td>
                            </tr>
                            @for (int i = 0; i < ViewBag.Reports.Count; i++)
                            {
                                StatReportDomain report = ViewBag.Reports[i];
                                <tr class="unfold_wrap @if (i == ViewBag.Reports.Count - 1) {@String.Format("last")}">
                                    <td></td>
                                    <td><a class="color_green">@report.StatKey</a></td>
                                    <td align="center"><a href="#"><i class="ico ico_visit_display"></i></a><a class="ml_1-5" href="#"><i class="ico ico_visit_time"></i></a></td>
                                    <td align="right">@report.SessionCount</td>
                                    <td align="right">@report.UniqueVisitor</td>
                                    <td align="right">@report.IpCount</td>
                                    <td align="right">@report.NewUniqueVisitor</td>
                                    <td align="right">@MathUtil.RoundPercent(report.BounceRate)%</td>
                                    <td align="center"><a style="float: none;" class="color_green unfold">查看</a></td>
                                </tr>
                                <tr class="unfold_cnt @if (i == ViewBag.Reports.Count - 1) {@String.Format("last")}">
                                    @if (report.RefLogCount != null && report.RefLogCount.Count > 0)
                                    {
                                        <td colspan="9">
                                            <table>
                                                @foreach (KeyValuePair<string, int> refLogCount in report.RefLogCount)
                                                {
                                                    <tr class="extraTrs">
                                                        <td width="20" style="padding: 9px 10px;"></td>
                                                        <td style="padding: 9px 10px;" align="left">@refLogCount.Key</td>
                                                        <td style="padding: 9px 10px;"></td>
                                                        <td style="padding: 9px 10px;" align="right">@refLogCount.Value</td>
                                                        <td style="padding: 9px 10px;"></td>
                                                        <td style="padding: 9px 10px;"></td>
                                                        <td style="padding: 9px 10px;"></td>
                                                        <td style="padding: 9px 10px;"></td>
                                                        <td style="padding: 9px 10px;"></td>
                                                        <td style="padding: 9px 10px;"></td>
                                                    </tr>
                                                }
                                            </table>
                                        </td>
                                    }
                                    else
                                    {
                                        <td></td>
                                        <td colspan="8">暂无数据</td>
                                    }
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $(".extraTrs").each(function () {
            $(this).find("td").each(function (i) {
                $(this).width($(".headRow td").eq(i).width());
            });
        });
    });
</script>